const io = require('socket.io-client');
navbarController.$inject = ['navMenuService', '$location'];

function navbarController(navMenuService, $location) {
    var vm = this;
    vm.menus = navMenuService.getMenus();

    vm.logout = function () {
        navMenuService.logout(function (response) {
            if (response.data.result) {
                $location.path('/');
            }
        });
    };

    var socketConfig ={
        path: "/O2OMerchant/api/socketio"
    };
    var socket = io.connect(location.origin, socketConfig);
    socket.on("orderToMerchant", function (message) {
        alert(message);
        console.log(message);
        // layer.msg(message,{time:2000});
    });
}

module.exports = navbarController;